//
//  AXFNewAddShopViewController.m
//  MineOrderUI
//
//  Created by mac2 on 16/11/20.
//  Copyright © 2016年 mac2. All rights reserved.
//

#import "AXFNewAddShopViewController.h"
#import "AXFLocationTableViewCell.h"
#import "AXFNearShopTableViewCell.h"
static NSString *shopCell = @"shopcell";
static NSString *nearCell = @"nearCell";
static NSString *locationCell = @"locationcell";
@interface AXFNewAddShopViewController ()

@property(nonatomic,strong)NSArray *nearShopList;
@end

@implementation AXFNewAddShopViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
//nearShopcell注册
    [self.tableView registerClass:[AXFNearShopTableViewCell class] forCellReuseIdentifier:nearCell];
//    self.tableView.rowHeight = 100;
//第一组定位cell注册
    [self.tableView registerClass:[AXFLocationTableViewCell class] forCellReuseIdentifier:locationCell];
    
    
}
//跳转二维码扫描
-(void)sweepClick{
    
}

-(void)setupUI{
    self.view.backgroundColor = [UIColor cz_colorWithHex:0xefefef];
    
    self.navigationItem.title = @"新增店铺";
    UIBarButtonItem *sweepShopBtn = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"bqqrscan"]style:UIBarButtonItemStylePlain target:self action:@selector(sweepClick)];

    self.navigationItem.rightBarButtonItem = sweepShopBtn;
    
    }
//数据源方法
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if(section == 0){
//        NSLog(@"第一组");
        
        return 1;
    };

    return 5;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.section == 0){
        AXFLocationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:locationCell];
        return cell;
    }

    AXFNearShopTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nearCell  forIndexPath:indexPath];
    return cell;
    
}
//组头设置
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.section == 0){
        return 46;
    }else{
        return 110;
    }
    
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headView = [[UIView alloc]initWithFrame:tableView.tableHeaderView.frame];
    if(section == 1){
        
        UILabel *labe = [[UILabel alloc]init];
        labe.text = @"附近的店铺";
        [labe setFont:[UIFont systemFontOfSize:13]];
        [headView addSubview:labe];
        [labe mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(headView);
            make.left.equalTo(headView).offset(10);
        }];
        return headView;
    }
    return NULL;
}



-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if(section == 0){
        return 10;
    }else{
        
        return 40;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
















@end
